package com.sgcc.nfc.lock.data.local.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.sgcc.nfc.lock.data.local.entity.LockEntity
import kotlinx.coroutines.flow.Flow

@Dao
interface LockDao {
    @Query("SELECT * FROM locks ORDER BY lockName ASC")
    fun observeLocks(): Flow<List<LockEntity>>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun upsertAll(locks: List<LockEntity>)

    @Query("DELETE FROM locks")
    suspend fun clear()
}
